/**
 * Created by zhaiyunzhi on 2017/1/3.
 */
import api from './config'

export function addDealer(param) {
    return api.post('api/dealer/addDealer',{
        code:param.code,
        company:param.company,
        contact:param.contact,
        phone1:param.phone1,
        phone2:param.phone2,
        email:param.email,
        address:param.address,
        position_id:param.position_id,
        province_id:param.province_id,
        city_id:param.city_id,
        type:param.type,
        sale_user_id:param.sale_user_id,
        start_date:param.start_date,
        end_date:param.end_date,
        caution_money:param.caution_money,
        more:param.more
    });
}
export function updateDealer(param) {
    return api.post('api/dealer/updateDealer',{
        dealer_id:param.dealer_id,
        company:param.company,
        contact:param.contact,
        phone1:param.phone1,
        phone2:param.phone2,
        email:param.email,
        address:param.address,
        position_id:param.position_id,
        province_id:param.province_id,
        city_id:param.city_id,
        type:param.type,
        sale_user_id:param.sale_user_id,
        start_date:param.start_date,
        end_date:param.end_date,
        caution_money:param.caution_money,
        more:param.more
    });
}
export function switchState(dealer_id,state) {
    return api.post('api/dealer/switchState', {
         dealer_id:dealer_id,
         state:state
    });
}

export function getSelectionList() {
    return api.post('api/dealer/getSelectionList', {
    });
}

export function getList(param) {
    return api.post('api/dealer/getList', {
        position_id:param.position_id,
        province_id:param.province_id,
        type:param.type,
        sale_user_id:param.sale_user_id,
        state:param.state,
        phone:param.phone,
    });
}

export function getDetail(dealer_id) {
    return api.post('api/dealer/getDetail', {
        dealer_id:dealer_id
    });
}

export function advance_payment_log(param) {
    return api.post('api/dealer/advance_payment_log', {
        dealer_id:param.dealer_id,
        page_index:param.page_index,
        page_size:param.page_size
    });
}

export function amount_detail_log(param) {
    return api.post('api/dealer/amount_detail_log', {
        dealer_id:param.dealer_id,
        page_index:param.page_index,
        page_size:param.page_size
    });
}

export function market_cost_log(param) {
    return api.post('api/dealer/market_cost_log', {
        dealer_id:param.dealer_id,
        page_index:param.page_index,
        page_size:param.page_size
    });
}